package chpt11;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;

public class URLReadTest {
	public static void main(String[] args) throws MalformedURLException {
		try {
			URL url = new URL("http://www.jmu.edu.cn/");
			InputStream is = url.openStream();
			BufferedReader br = new BufferedReader(
					new InputStreamReader(is));
			String line;
			while((line = br.readLine())!=null) {
				System.out.println(line);
			}
		} catch (MalformedURLException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
